package com.alamiya.security.controller;


import com.alamiya.security.entity.PublicUser;
import com.alamiya.security.service.IPublicUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class UserRestController {

   @Autowired
   private IPublicUserService userService;

   @GetMapping("/user")
   public ResponseEntity<PublicUser> getActualUser() {
      return ResponseEntity.ok(userService.getUserWithAuthorities().get());
   }
}
